<template>
	<view class="" style="padding: 0 54rpx;">
		<view class="" style="margin-top: 62rpx;display: flex;justify-content: center;">
			<image src="/static/image/login/logo.png" style="width: 240rpx;height: 240rpx;" mode=""></image>
		</view>
		<view class=""
			style="margin-top: 74rpx;height: 98rpx;padding: 34rpx 50rpx;display: flex;align-items: center;background-color: #FBFBFB;">
			<image src="/static/image/login/mobile.png" style="width: 24rpx;height: 32rpx;margin-right: 40rpx;" mode="">
			</image>
			<input type="text" placeholder="请输入手机号" v-model="param.mobile">
		</view>
		<view class=""
			style="margin-top: 40rpx;height: 98rpx;padding: 34rpx 50rpx;display: flex;align-items: center;background-color: #FBFBFB;">
			<image src="/static/image/login/password.png" style="width: 24rpx;height: 32rpx;margin-right: 40rpx;"
				mode=""></image>
			<input type="password" placeholder="请输入密码" v-model="param.password">
		</view>
		<view class="" style="margin-top: 40rpx;display: flex;justify-content: space-between;">
			<view class="" style="font-size: 24rpx;color: #FF2842;" @click="forgetPsd">
				忘记密码？
			</view>
			<view class="" style="font-size: 24rpx;color: #FF2842;" @click="register">
				立即注册
			</view>
		</view>
		<view class="" @click="sumbit"
			style="margin-top: 100rpx;height: 94rpx;color: white;background-color: #FF4D62;border-radius: 10rpx;display: flex;justify-content: center;align-items: center;">
			<span>登录</span>
		</view>
		<sc-home></sc-home>
	</view>
</template>

<script>
	import {
		psdLogin
	} from '@/common/login.js'
	export default {
		data() {
			return {
				param: {
					mobile: '',
					password: ''
				}
			}
		},
		methods: {
			register() {
				uni.navigateTo({
					url: '/pages/register/register'
				})
			},
			forgetPsd() {
				uni.navigateTo({
					url: '/pages/forgetPsd/forgetPsd'
				})
			},
			//登录
			sumbit() {
				psdLogin(this.param).then((res) => {

					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					if (res.code == 1) {
						uni.setStorageSync('token', res.msg)
						uni.switchTab({
							url: '/pages/index/index'
						})
					}
				}).catch((err) => {
					console.log(err);
				})
			}
		},

	}
</script>

<style scoped lang="scss">
	page {
		background-color: white;
	}
</style>